using System;


namespace Commons.Geom
{
	[Serializable]
	public struct Index2
	{
		public int x, y;

		public Index2 (int x, int y)
		{
			this.x = x;
			this.y = y;
		}

		public override string ToString()
		{
			return "(" + x + "," + y + ")";
		}

		public override bool Equals(object obj)
		{
			return (obj is Index2) && this == (Index2)obj;
		}

		public override int GetHashCode()
		{
			int hash = 13;
			hash = (hash * 7) + x.GetHashCode();
			hash = (hash * 7) + y.GetHashCode();
			return hash;
		}
		
		public static bool operator ==(Index2 c1, Index2 c2) 
		{
			return c1.x==c2.x && c1.y==c2.y;
		}
		
		public static bool operator !=(Index2 c1, Index2 c2) 
		{
			return c1.x!=c2.x || c1.y!=c2.y;
		}
	}
}

